package cn.edu.lzzy.mypractices.repository;

import cn.edu.lzzy.mypractices.entity.Chapter;
import cn.edu.lzzy.mypractices.entity.Course;
import cn.edu.lzzy.mypractices.entity.Question;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;
import java.util.UUID;

public interface QuestionRepository extends JpaRepository<Question, UUID> {
    // 根据章节获取所有的题目
    List<Question> findAllByChapter(Chapter chapter);
    List<Question> findAllByChapterId(UUID chapter_id);

    List<Question> findAllByChapter(Chapter chapter, Pageable pageable);
    List<Question> findAllByChapterId(UUID chapter_id, Pageable pageable);

    // 获取指定章节下的题目数量
    Integer countAllByChapter(Chapter chapter);
    Integer countAllByChapterId(UUID chapter_id);
}
